import json
from urllib import request

#This is the ComfyUI api prompt format.

#If you want it for a specific workflow you can "enable dev mode options"
#in the settings of the UI (gear beside the "Queue Size: ") this will enable
#a button on the UI to save workflows in api format.

#keep in mind ComfyUI is pre alpha software so this format will change a bit.

#this is the one for the default workflow


def queue_prompt(prompt):
    p = {"prompt": prompt}
    data = json.dumps(p).encode('utf-8')
    req =  request.Request("http://139.224.239.149:7863/prompt", data=data)
    request.urlopen(req)


# 从 JSON 文件中读取数据
with open('generated_workflow/dad.json', 'r', encoding='utf-8') as file:
    prompt = json.load(file)
#set the text prompt for our positive CLIPTextEncode



queue_prompt(prompt)